<?php
	
	
class M_search extends CI_Model{
	
		public function __construct(){
			parent::__construct();
			$this->load->database();
		}
	
		
		public function get_user($data){
			if($data == FALSE){
				return FALSE;
			}else{
				foreach($data as $key => $value){
					if($value !== '')
						$search_string[$key] = $value;
				}
				$query = $this->db->like($search_string)->get('users');
				return $query->num_rows() > 0 ? $query->result() : NULL;
			}
		}
		
		public function get_student($data = FALSE){
			if($data == FALSE){
				return FALSE;
			}else{
				foreach($data as $key => $value){
					if($value !== '')
						$search_string[$key] = $value;
				}
				$query = $this->db->select(array('firstname','lastname','middlename','user_id'))->like($search_string)->get('student_profiles');
				return $query->num_rows() > 0 ? $query->result() : NULL;
			}
		}
		
		public function get_course_menu(){
			$query = $this->db->select(array('course_code','course_name','course_id'))->get('courses');
			return $query->num_rows() > 0 ? $query->result() : FALSE;
		}
}